// [00:00.000]
const cutTimeReg = /\[(\d{2}):(\d{2}).(\d{2,3})\]/

export function parsingLyrics(lyricsString){
  // 歌词是以\n换行
  const lyricString = lyricsString.split('\n')
  const lyr = []
  for(const line of lyricString){
// [00:00.000] 作词 : Mayumi/李焯雄\n[00:01.000] 作曲 : 松本俊明
// 获取时间[00:00.000]
   //使用正则进行截取 
   const timeReg = cutTimeReg.exec(line)
   if(!timeReg)continue
   const minutes = timeReg[1] * 60 *1000
   const second = timeReg[2] * 1000
   const mill = timeReg[3]
   const millisecond = mill.leng === 2 ? mill * 10: mill * 1
   const time = minutes + second + millisecond
//  获取歌词
  //replace:替换    
   const text = line.replace(cutTimeReg,"")
   lyr.push({time,text})

 }
  return lyr
}